home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d2 / option.arc / OPTION.DOC < prev    next >
Encoding:
Text File  |  1988-01-16  |  3.1 KB  |  69 lines

  1.                                 Using OPTION.COM
  2.            notes on Edward Morris's "Errorlevel Made Easy" article in
  3.                     PC Magazine 16 February 1988 pp. 359-60
  4.  
  5. To create a copy of OPTION.COM, put OPTION.SCR (another file ARCed with this 
  6. one) on a disk with DEBUG.COM and use the command
  7.  
  8.                                DEBUG < OPTION.SCR
  9.  
  10. OPTION.COM prompts for and then tests keyboard input and returns errorlevels 
  11. matched to the key pressed.
  12.                                     Syntax:
  13.  
  14.                       OPTION KE[KE][KE][KE][...][-prompt]
  15.  
  16. where "KE" pairs are made up of
  17.        K=keypress (any keyboard key; use + for ENTER/RETURN key)
  18.         E=errorlevel code to be returned when paired K is pressed (number 0-9, 
  19.           then for 10 use :, for 11 use ;, for 15 use ?, and so on for higher 
  20.           values [follow sequence of ASCII characters after "9" but avoid 
  21.           characters like >, for 14, that DOS will attempt to execute]) 
  22. and where "-prompt" is an optional prompt message preceded by a hyphen.
  23.  
  24.  
  25. If an odd number of arguments (a broken pair) are specified on the command 
  26. line, OPTION returns the last character as an errorlevel if any key except the 
  27. one in the last valid pair is pressed (so OPTION A10 will return errorlevel 0 
  28. if any key other than capital A is struck). 
  29.  
  30. EXAMPLE:  [xx] in the example represents two spaces
  31.  
  32.                 OPTION A1a1B2b2-Enter your choice: A or B?[xx]
  33.  
  34.         User is prompted: "Enter your choice: A or B?" and cursor is put two 
  35.                            spaces after question mark.
  36.  
  37.         User presses A or a; OPTION returns errorlevel 1
  38.         User presses B or b; OPTION returns errorlevel 2
  39.         User presses some other key; OPTION beeps and waits for another try
  40.  
  41.  
  42. Changes: 
  43.  
  44. (Note: these changes apply to the original OPTION.COM only!!  Included in this 
  45. ARC file is another version of OPTION, called OPTIONQ.  Do NOT try the patches 
  46. below on OPTIONQ; they will work only on the original OPTION.COM.)
  47. (OPTIONQ.COM should be identical to OPTION.COM in operation with one exception: 
  48. OPTIONQ does not beep when it first prompts for user input.)
  49.  
  50.      OPTION beeps to prompt for input or to reject illegal keys.  To stop all 
  51. the beeps, make the following patch: 
  52.  
  53.         DEBUG OPTION.COM                        <enter>
  54.         E 12A 90 90                             <enter>
  55.         W                                       <enter>
  56.         Q                                       <enter>
  57.  
  58.      OPTION clears the screen and puts the cursor in the upper-left corner when 
  59. it accepts a keypress.  To display the key and move the cursor down a line 
  60. instead, make the following patch:
  61.  
  62.         DEBUG OPTION.COM
  63.         E151 B4 02 CD 21 B2 0D CD 21 B2          <enter>
  64.         E15A 0A CD 21 58 B4 4C CD 21             <enter>
  65.         RCX                                      <enter>
  66.         62                                       <enter> 
  67.         W                                        <enter>
  68.         Q                                        <enter>
  69.